package test;

//生成订单号的规则   可以使用生成  账户号
public class UniqueStringGenerator {
	private static final int MAX_GENERATE_COUNT = 99999;
	private static int generateCount = 0;
	
	//无参构造方法
	private UniqueStringGenerator() {
	}

	public static synchronized String getUniqueString() {
		if (generateCount > MAX_GENERATE_COUNT)
			generateCount = 0;
		String uniqueNumber = Long.toString(System.currentTimeMillis())
				+ Integer.toString(generateCount);
		generateCount++;
		return uniqueNumber;
	}
	
	
	public static void main(String args[]){
		System.out.println(UniqueStringGenerator.getUniqueString());
		System.out.println(UniqueStringGenerator.getUniqueString());
		System.out.println(UniqueStringGenerator.getUniqueString());
		System.out.println("-------------------------");
		System.out.println(System.getProperties());
		System.out.println("-------------------------");
	}
}